<?php
namespace app\short\controller;

use app\common\model\UrlsModel;
use think\Controller;
use think\facade\Request;

class Index extends Controller
{
    public function index()
    {
        $short_code = Request::pathinfo();
        $urlsModel = new UrlsModel();
        $urlInfo = $urlsModel->findByShortcode($short_code);
        if($urlInfo){

            $this->redirect($urlInfo['origin_url']);
        }
        $this->error('页面不存在');
    }

    public function hello($name = 'ThinkPHP5')
    {
        return 'hello,' . $name;
    }
}
